/**
 * 
 */
package cn.gov.msa.controller;

import java.io.IOException;

import org.dom4j.DocumentException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.xmlpull.v1.XmlPullParserException;

import cn.gov.msa.util.PropertiesTools;
import cn.gov.msa.util.WebServiceTools;
import net.sf.json.JSONObject;

/**   
* @Title: BusinessControll.java 
* @Package cn.gov.msa.controller 
* @Description: TODO(用一句话描述该文件做什么) 
* @author 何宇江  
* @date 2018年2月21日 上午11:34:09 
*/


@RestController
@RequestMapping(value = "/declare", produces = "text/plain;charset=UTF-8")
public class DeclareController {

	
	private static String url  = PropertiesTools.readProperties("gahWS.url");
	private String methods = "stirnggetData";
	
	@RequestMapping(value = "/list", method = RequestMethod.POST)
	public String getList(@RequestBody JSONObject param) throws Exception {
    			
//        String url = PropertiesTools.readProperties("gahWS.url");      

		param.put("isdeclare", "1");
        String[] parameter = new String[]{"DLU101", param.toString()};       
        String result = WebServiceTools.getDatasByUrl(url, methods, parameter);
           	System.err.println(result);
        return result;  
    } 
	
	@RequestMapping(value = "/getguideinfo")
	public String getguideinfo(String sgid) throws Exception {
    			
//        String url = PropertiesTools.readProperties("gahWS.url");       
        String[] parameter = new String[]{"DLU101_1", sgid};       
        String result = WebServiceTools.getDatasByUrl(url, methods, parameter);
           	
        return result;  
    }
	
	
	@RequestMapping(value = "/guidetable")
	public String guidetable(@RequestBody JSONObject param) throws Exception {
    			
//        String url = PropertiesTools.readProperties("gahWS.url");       
        String[] parameter = new String[]{"DLU101_2", param.toString()};       
        String result = WebServiceTools.getDatasByUrl(url, methods, parameter);
           	
        return result;  
    }
	
	@RequestMapping(value = "/guidetable1")
	public String guidetable1(@RequestBody JSONObject param) throws Exception {
    			
//        String url = PropertiesTools.readProperties("gahWS.url");       
        String[] parameter = new String[]{"DLU101_3", param.toString()};       
        String result = WebServiceTools.getDatasByUrl(url, methods, parameter);
           	
        return result;  
    }
	
	
	
	
}
